<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简易轮播图</title>
    <style>
        @keyframes moving {
            from {
                transform: translate(0);
            }
            30%,
            40% {
                transform: translate(-300px);
            }
            60%,
            70% {
                transform: translate(-600px);
            }
            to {
                transform: translate(0);
            }
        }
        
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }
        
        .box {
            margin: 20px;
            position: relative;
            width: 300px;
            height: 200px;
            border: solid #000;
            overflow: hidden;
        }
        
        ul {
            position: absolute;
            top: 0;
            left: 0;
            width: 900px;
            height: 100%;
            display: flex;
            animation: moving 6s infinite;
        }
        
        li {
            width: 300px;
            height: 100%;
        }
        
        .imgBox {
            color: #000;
            font-size: 40px;
            text-align: center;
            line-height: 175px;
        }
        
        .red {
            width: 100%;
            height: 100%;
            background-color: red;
        }
        
        .green {
            width: 100%;
            height: 100%;
            background-color: green;
        }
        
        .blue {
            width: 100%;
            height: 100%;
            background-color: blue;
        }
    </style>
</head>

<body>
    <div class="box">
        <ul>
            <li>
                <div class="imgBox red">red</div>
            </li>
            <li>
                <div class="imgBox green">green</div>
            </li>
            <li>
                <div class="imgBox blue">blue</div>
            </li>
        </ul>
    </div>
</body>

</html>